using System;
using System.Collections.Generic;
using System.Text;

namespace EBookReader.Library.Data
{
    [Serializable]
    public class EBookInfo : IDisposable
    {
        [NonSerialized]
        private PageInfo page;
        [NonSerialized]
        private string title;
        [NonSerialized]
        private string author;
        [NonSerialized]
        Queue<BookChapter> chapters;

        public EBookInfo()
        {
            page = new PageInfo();
            title = string.Empty;
            author = string.Empty;
            chapters = new Queue<BookChapter>();
        }

        public void Dispose()
        {
            page = null;
            title = null;
            author = null;
            Queue<BookChapter>.Enumerator en=chapters.GetEnumerator();
            while (en.MoveNext())
            {
                en.Dispose();
            }
            en.Dispose();
            chapters.Clear();
            chapters = null;
        }

        public PageInfo Page
        {
            get { return page; }
            set { page = value; }
        }

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        public string Author
        {
            get { return author; }
            set { author = value; }
        }

        public Queue<BookChapter> Chapters
        {
            get { return chapters; }
            set { chapters = value; }
        }
    }
}
